//package com.uvlab.sitespot.init;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.config.http.SessionCreationPolicy;
//
//import javax.sql.DataSource;
//
///**
// * Created by Administrator on 2016/7/4 0004.
// */
//@Configuration
//@EnableWebSecurity
//public class JxSecurityConfig extends WebSecurityConfigurerAdapter {
//    @Autowired
//    DataSource userdata;
//
//    @Autowired
//    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
//        auth.inMemoryAuthentication().withUser("admin").password("123456").roles("USER");
//        auth.jdbcAuthentication().dataSource(userdata)
//                .usersByUsernameQuery("select username,password, enabled from users where username=?")
//                .authoritiesByUsernameQuery("select username, role from user_roles where username=?");
//    }
//
//    protected void configure(HttpSecurity http) throws Exception {
//        http
//                .authorizeRequests()
////                .antMatchers("/rest/**").hasRole("USER")
////                .antMatchers("/**").permitAll()         // later version needed
//                .antMatchers("/module/**").hasRole("USER")   //template version
//                .antMatchers("/**").permitAll()
//                .anyRequest().authenticated()
//                .and()
//                .formLogin()
//                .and()
//                .headers().frameOptions().sameOrigin()
//                .and()
//                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER) //session 管理策略
//                .and()
//                .csrf().disable();
//    }
//}
